


// Vuex对象
const user = {
    state() {
        return {
            token: '',
            uinfo: null
        }
    },
    getters: {
        isLogin (state) {
            return state.token? true:false
        },
        getToken (state) {
            return state.token
        },
        getUInfo (state) {
            return state.uinfo
        }
    },
    mutations: {
        updateTokenMutations (state, t) {
            state.token = t
        }
    },
    actions: {
        // Update token
        t({ commit, state }, token) {
            commit('updateTokenMutations', token)
        },

        // 退出登录
        logout({ commit, state }) {
            commit('updateTokenMutations', '')
        },
    }
}


export default user